<?php
session_start();
header("Content-type:text/html;charset=utf-8");
$con=mysqli_connect("localhost","root","","login");
if(!$con)
{
	echo mysqli_connect_error();
}



$username=isset($_POST['username'])?$_POST['username']:null;
$password=isset($_POST['password'])?md5($_POST['password']):null;
/*
//查询
//$sql="select * from `login` where `user`='".$username."' and `password`='".$password."'";
$sql="select `password` from `login` where `user` = '".$username."'";
$set=mysql_query($sql);
$result=mysql_fetch_array($set);

if($result['password']==$password)
{
	$_SESSION['login']=$username;
	echo "<script>alert('登录成功');location='http://www.baidu.com';</script>";
}
*/
?>

<html>
<head>
<title>网站登录</title>
</head>

<body>
	<form action="login.php" method="post">
		请输入信息登录<br />
		帐号：<input type="text" name="username"><br />
		密码：<input type="password" name="password"> <br />
		<input type="submit" name="sub" value="登录">
	</form>
</body>

</html>